package com.lianzheng.dao.impl;

import java.util.List;
import java.util.Map;
import java.util.HashMap;

import com.lianzheng.dao.TbSysPartcodeDAO;
import com.lianzheng.model.TbSysPartcode;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.orm.ObjectRetrievalFailureException;
import org.springframework.stereotype.Repository;


/**
 * This class interacts with Spring's IbatisTemplate to save/delete
 * <p>
 * <a href="TbSysPartcode.DAOimpl.java.html"><i>View Source</i></a>
 * </p>
 *
 * @author <a href="mailto:heymanchen@gmail.com">haihua chen</a>
*/
@Repository
public class TbSysPartcodeDAOimpl extends SqlMapClientDaoSupport implements TbSysPartcodeDAO {

    /**
     * @see com.lianzheng.dao.TbSysPartcodeDAO#getTbSysPartcode($keytype)
     */

    public TbSysPartcode getTbSysPartcode(java.math.BigDecimal id){
        return (TbSysPartcode)getSqlMapClientTemplate().queryForObject("getTbSysPartcode", id);
    }

    public TbSysPartcode getTbSysPartcodeFull(java.math.BigDecimal id){
        return (TbSysPartcode)getSqlMapClientTemplate().queryForObject("getTbSysPartcodeFull", id);
    }

    public void addTbSysPartcode(final TbSysPartcode tbSysPartcode) {
        getSqlMapClientTemplate().update("addTbSysPartcode", tbSysPartcode);
    }

    public void updateTbSysPartcode(final TbSysPartcode tbSysPartcode) {
    getSqlMapClientTemplate().update("updateTbSysPartcode", tbSysPartcode);
    }

    public void removeTbSysPartcode(java.math.BigDecimal id){
        getSqlMapClientTemplate().update("removeTbSysPartcode", id);
    }

    public List getTbSysPartcodes() {
        return getSqlMapClientTemplate().queryForList("getTbSysPartcodes",null);
    }

    public List getTbSysPartcodeByAnd(final TbSysPartcode tbSysPartcode,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_AND, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbSysPartcode.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbSysPartcodeByMap", tbSysPartcode);
    }

    public List getTbSysPartcodeByOr(final TbSysPartcode tbSysPartcode,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_OR, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbSysPartcode.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbSysPartcodeByMap", tbSysPartcode);
    }
    
    public List getTbSysPartcodeByLike(final TbSysPartcode tbSysPartcode,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_LIKE, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbSysPartcode.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbSysPartcodeByMap", tbSysPartcode);
    }
}